local juenu = fk.CreateSkill {
  name = "th_juenu",
  max_phase_use_time = 2,
}

juenu:addEffect("active", {
  name = "th_juenu",
  anim_type = "offensive",
  prompt = "#th_juenu",
  card_num = 0,
  card_filter = Util.FalseFunc,
  target_num = 0,
  target_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    local card = Fk:getCardById(room:getNCards(1)[1])
    room:moveCardTo(card, Card.Processing, nil, fk.ReasonJustMove, juenu.name, nil, true, player.id)
    local _, dat = room:askToUseActiveSkill(player, {
      skill_name = "#th_juenu_use",
      prompt = "#th_juenu_ask:::" .. card:getTypeString(),
      cancelable = true,
      extra_data = {
        skillName = juenu.name,
        juenu_type = card.type,
        bypass_times = true
      }
    })
    if dat then
      local tocard = dat.cards[1]
      room:moveCards(
        {
          ids = { tocard },
          from = room:getCardOwner(tocard),
          toArea = Card.Processing,
          moveReason = fk.ReasonJustMove,
          skillName = juenu.name,
          proposer = player,
          moveVisible = true
        },
        {
          ids = Card:getIdList(card),
          to = player,
          toArea = Card.PlayerHand,
          moveReason = fk.ReasonJustMove,
          skillName = juenu.name,
          proposer = player,
          moveVisible = true
        }
      )
      -- room:moveCardTo(tocard, Card.Processing, nil, fk.ReasonJustMove, juenu.name, nil, true, player)
      -- room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonJustMove, juenu.name, nil, true, player)
      local c = Fk:cloneCard("slash")
      c.skillName = "th_juenu"
      room:useCard{
        from = player,
        tos = dat.targets,
        card = c
      }
    end
    room:cleanProcessingArea(nil, juenu.name)
  end
}, { check_skill_limit = true })

Fk:loadTranslationTable{
  ["th_juenu"] = "绝怒",
  [":th_juenu"] = "出牌阶段限两次，你可以亮出牌堆顶一张牌，然后你可以用一张同类型的牌替换之，视为使用一张【杀】。",

  ["#th_juenu"] = "绝怒：亮出牌堆顶一张牌，然后你可以用一张同类型的牌替换之，视为使用一张【杀】",

  ["#th_juenu_ask"] = "绝怒：你可以用一张%arg替换之，视为使用一张【杀】",
}

return juenu